package com.dj.dormitory.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dj.dormitory.entity.Selection;
import com.dj.dormitory.entity.req.SelectionReq;
import com.dj.dormitory.entity.vo.SelectionVo;
import com.dj.dormitory.mapper.SelectionMapper;
import com.dj.dormitory.service.SelectionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.util.StringUtil;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author DJ同学
 * @since 2021-01-24
 */
@Service
public class SelectionServiceImpl extends ServiceImpl<SelectionMapper, Selection> implements SelectionService {

    @Override
    public Map<String,Object> getList(SelectionReq selectionReq) {
        Page<Selection> page = new Page<>(selectionReq.getPage(),selectionReq.getLimit());
        List<SelectionVo> list = this.baseMapper.getList(page,selectionReq);
        Map<String,Object> map = new HashMap<>();
        map.put("count",page.getTotal());
        map.put("selections",list);
        return map;
    }
}
